﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using Pixysoft.Framework.Reflection.Controller;

namespace Pixysoft.Framework.Reflection.Core
{
    internal delegate object DynamicFieldGetHandler(object obj);

    internal delegate void DynamicFieldSetHandler(object obj, object value);

    class DynamicFieldInfo : IDynamicFieldInfo
    {
        DynamicFieldSetHandler setHandler = null;

        DynamicFieldGetHandler getHandler = null;

        public DynamicFieldInfo(DynamicFieldSetHandler setHandler, DynamicFieldGetHandler getHandler)
        {
            this.setHandler = setHandler;

            this.getHandler = getHandler;
        }

        public object GetValue(object obj)
        {
            return this.getHandler(obj);
        }

        public void SetValue(object obj, object value)
        {
            this.setHandler(obj, value);
        }
    }
}
